package org.example

class Book(val title: String, val author: String, val isbn: String) {
  private var _borrowed: Boolean = false

  def borrowed: Boolean = _borrowed

  def borrow(): Unit = {
    _borrowed = true
  }

  def returnBook(): Unit = {
    _borrowed = false
  }
}
object Book {
  def apply(title: String, author: String, isbn: String): Book = {
    new Book(title, author, isbn)
  }

  def unapply(book: Book): Option[(String, String, String)] = {
    Some(book.title, book.author, book.isbn)
  }
}